Skip to content

fix(cli): detect global npm self-update installs#1213

Merged
christso merged 3 commits intomainfrom
fix/self-update-global-scope
May 4, 2026
Merged

fix(cli): detect global npm self-update installs#1213
christso merged 3 commits intomainfrom
fix/self-update-global-scope

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented May 4, 2026

Summary

Fix agentv self update misclassifying Windows global npm installs as local project installs.

Root cause

Global npm installs on Windows commonly execute from a path like AppData/Roaming/npm/node_modules/agentv/dist/cli.js. The CLI treated any path containing node_modules as local, so self-update ran npm install agentv@latest instead of npm install -g agentv@latest.

Changes

  • detect local installs using project cwd rather than any node_modules segment
  • preserve local classification for npx cache paths
  • add regression coverage for Windows global npm installs and project-local node_modules cases
  • align the existing local-install tests with the new cwd-aware behavior

Validation

  • bun test apps/cli/test/self-update.test.ts
    • passed: 22 tests, 0 failed
  • direct executable check of detectInstallScopeFromPath for Windows global npm, project-local, and npx cache paths

Closes #1210

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 4, 2026

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a23d52
Status: ✅  Deploy successful!
Preview URL: https://6456a388.agentv.pages.dev
Branch Preview URL: https://fix-self-update-global-scope.agentv.pages.dev

View logs

@christso christso merged commit 3c628be into main May 4, 2026
4 checks passed
@christso christso deleted the fix/self-update-global-scope branch May 4, 2026 04:17
christso added a commit that referenced this pull request May 4, 2026
…1214)

* fix(core): drop api_format from Azure targets; surface pi-ai errors

Two regressions from the Vercel AI SDK → pi-ai migration (#1206) broke
Azure evals end-to-end whenever a target had api_format=chat (or unset
on a config still defaulting to it):

1. The migration kept the api_format field but pi-ai's azure-openai-
   responses provider always hits /openai/v1/responses. With chat-style
   defaults still in place, AgentV sent ?api-version=2024-12-01-preview
   to the Responses path, which Azure rejects with 400 "API version
   not supported." Every eval call failed.

2. invokePiAi never inspected pi-ai's stopReason. When pi-ai surfaced
   the 400 as { stopReason: 'error', errorMessage: '...', content: [] },
   the adapter happily returned an empty assistant message, which
   downstream graders then reported as "Unexpected EOF" JSON parse
   failures — completely hiding the underlying HTTP error.

Fix:
- Remove api_format from Azure targets entirely. Pi-ai's adapter only
  exposes the Responses path, so a chat/responses switch on this
  provider has no effect. Default Azure api version to v1 (matching the
  /openai/v1/responses path). Reject api_format on Azure targets at both
  validation and resolution time with a migration message pointing at
  `provider: openai` for chat-completions-only deployments. api_format
  remains supported on `provider: openai`.
- Throw from invokePiAi when pi-ai returns stopReason 'error' so failures
  reach the surface and withRetry can apply its status-based retry
  policy. The thrown message includes the parsed HTTP status so
  isRetryableError can decide correctly.

Also drops api_format from the repo's .agentv/targets.yaml and updates
the Azure provider docs to document the migration path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: biome formatter pass on self-update files

Pure whitespace fix from `biome format --write` on apps/cli/src/self-update.ts
and apps/cli/test/self-update.test.ts. Pre-existing issue from #1213; the
pre-push hook fails on these files independently of any other change, so
fixing them here unblocks the bug-fix branch's push.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: extend code-grader to accept plain-text and exit-code output

1 participant